﻿using Microsoft.AspNetCore.SignalR.Client;
using System;

namespace FlyingEyeClient.ApplicationServices.SignalRHubs
{
    public class SignalRRetryPolicy : IRetryPolicy
    {
        public TimeSpan? NextRetryDelay(RetryContext retryContext)
        {
            /*
            // If we've been reconnecting for less than 60 seconds so far,
            // wait between 0 and 10 seconds before the next reconnect attempt.
            if (retryContext.ElapsedTime < TimeSpan.FromSeconds(3600))
            {
                return TimeSpan.FromSeconds(10);
            }
            else
            {
                // If we've been reconnecting for more than 60 seconds so far, stop reconnecting.
                return null;
            }
            */

            // 每 10s 重新连接一次
            return TimeSpan.FromSeconds(10);
        }
    }
}
